<?php

namespace App\Models;

use App\User;
use Illuminate\Database\Eloquent\Model;


class WxUser extends Model
{
    protected $table = 'wx_user';
    protected $guarded = [];


    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    public static function getSessionKey($app, $code)
    {

        return \Cache::remember("getSessionKey" . $code, 7000, function () use ($code, $app) {
            return $app->auth->session($code);
        });

    }
}
